import { _decorator, Component, SpriteFrame, Animation, AnimationClip } from 'cc';
import State from './State';
import { FSM_PARAMS_TYPE_ENUM } from '../Enums';
import { StateMachine } from './StateMachine';
const { ccclass, property } = _decorator;

/**
 * 有限状态机 fsm 子状态机
 */

export abstract class SubStateMachine {
  /**
   * 子状态机，公用父状态机的 params
   * @param fsm 父状态机
   */
  constructor(public fsm:StateMachine) {}

  // 当前状态
  private _currentState:State = null
  states: Map<string, State> = new Map()

  get currentState() {
    return this._currentState
  }
  set currentState(newState:State) {
    this._currentState = newState
    this._currentState.run()
  }

  abstract run() :void
}
